#-*- encoding:utf-8 -*-
from web import form
from components import validations

post_form = form.Form(
	form.Hidden('id',description='ID',type='hidden'),
	form.Hidden('status',value='published'),
	form.Textbox('title',validations.required(),description='标题',placeholder='请在这里输入标题'),
	form.Textarea('content',description='内容',placeholder='请在这里输入内容'),
)

user_form = form.Form(
	form.Textbox('username',validations.limited(4,12),description='用户名'),
	form.Textbox('nick',validations.limited(4,8),description='用户昵称'),
	form.Password('password',validations.limited(6),description='用户密码'),
	form.Password('password2',validations.limited(6),description='重复密码'),
	form.Textbox('email',validations.email(),description='Email'),
	form.Textbox('website',description='网站/博客/微博'),
	form.Radio('role',
		args=[('creative','设计师'),('manufacture','生产商')],
		value='creative',description='用户类别'
	),
	validators = [
		form.Validator("密码不一致", lambda i: i.password == i.password2),
	]
)

settings_form = form.Form(
	form.Textbox('website_url',validations.required(),description='网站域名',placeholder='请在这里输入网站域名'),
	form.Textbox('website_title',validations.required(),description='网站标题',placeholder='请在这里输入标题'),
	form.Textbox('website_subtitle',validations.required(),description='网站副标题',placeholder='请在这里输入副标题'),
	form.Textbox('pagination',validations.required(),description='每页文章数目',placeholder='请在这里输入文章列表每页数目',autocomplete='off'),
	form.Password('password',validations.required(),description='管理员密码',placeholder='请在这里输入管理员密码',autocomplete='off'),
	form.Textarea('comment_code',description='第三方评论系统代码',placeholder='第三方评论系统代码'),
	form.Textarea('statistic_code',description='网站统计代码',placeholder='网站统计代码'),
	form.Textarea('about',validations.required(),description='关于',placeholder='请在这里输入关于内容'),
)

